package worldinruin.gui.imp.gameview;


import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.border.EtchedBorder;

import worldinruin.core.IResources;
import worldinruin.core.imp.ResourceTypes;
import worldinruin.resources.IconMap;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ResourcePricePanel extends javax.swing.JPanel {
	private JLabel woodIcon;
	private JLabel foodIcon;
	private JLabel ironIcon;
	private JLabel stoneIcon;
	private IResources price;
	
	/**
	 * Creates a resource price panel to display purchase prices.
	 * @param price Price of product.
	 */
	public ResourcePricePanel(IResources price){
		this.price = price;
		initGUI();
		setupGUI();
	}
	
	/**
	 * Setup GUI.
	 */
	public void setupGUI(){
		
		woodIcon.setIcon(IconMap.getInstance().getScaledIcon(IconMap.getInstance().getIcon(ResourceTypes.WOOD), 50, 50));
		stoneIcon.setIcon(IconMap.getInstance().getScaledIcon(IconMap.getInstance().getIcon(ResourceTypes.STONE), 50, 50));
		ironIcon.setIcon(IconMap.getInstance().getScaledIcon(IconMap.getInstance().getIcon(ResourceTypes.IRON), 50, 50));
		foodIcon.setIcon(IconMap.getInstance().getScaledIcon(IconMap.getInstance().getIcon(ResourceTypes.FOOD), 50, 50));
		
		setBorder(new EtchedBorder());
		woodIcon.setText(price.getWood()+"");
		stoneIcon.setText(price.getStone()+"");
		ironIcon.setText(price.getIron()+"");
		foodIcon.setText(price.getFood()+"");
		
	}
	
	/**
	 * Initiate GUI.
	 */
	private void initGUI() {
		try {
			setPreferredSize(new Dimension(500, 50));
			GridLayout thisLayout = new GridLayout(1, 1);
			thisLayout.setHgap(5);
			thisLayout.setVgap(5);
			thisLayout.setColumns(1);
			this.setLayout(thisLayout);
			{
				woodIcon = new JLabel();
				this.add(woodIcon);
			}
			{
				stoneIcon = new JLabel();
				this.add(stoneIcon);
			}
			{
				ironIcon = new JLabel();
				this.add(ironIcon);
			}
			{
				foodIcon = new JLabel();
				this.add(foodIcon);
								
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	

}
